import requests
# 员工管理模块的接口对象层
class IhrmEmpCURD(object):
    @classmethod
    def add_emp(cls, header, json_data):
        resp = requests.post(
            url="https://ihrm-java.itheima.net/api/sys/user",
            headers=header,
            json=json_data
        )
        return resp

    # 查询
    @classmethod
    def query_emp(cls, empid,header):
        resp = requests.get(
            url="https://ihrm-java.itheima.net/api/sys/user/" + empid,
            headers=header
        )
        print(resp.json())
        return resp
    # 修改
    @classmethod
    def modify_emp(cls, empid, header, modify_data):
        resp = requests.put(
            url="https://ihrm-java.itheima.net/api/sys/user/" + empid,
            headers=header,
            json=modify_data,
        )
        print(resp.json())
        return resp
    # 删除
    @classmethod
    def del_emp(cls,empid,header):
        resp = requests.delete(
            url="https://ihrm-java.itheima.net/api/sys/user/" + empid, headers=header
        )
        print(resp.json())
        return resp

